﻿package server.qiang.database;

import java.util.HashMap;


public class IpMap {
	private HashMap<String, IpObject> ipmap;
	private static IpMap ipinstance;

	public IpMap() {
		ipmap = new HashMap<String, IpObject>();
	}

	public synchronized static IpMap getInstance() {

		if (ipinstance == null) {

			ipinstance = new IpMap();

		}

		return ipinstance;

	}

	public synchronized void add(String id, IpObject ip) {
		ipmap.put(id, ip);
	}

//移除IP对象


	public synchronized void remove(String id) {
		ipmap.remove(id);
	}


//取出IP对象


	public synchronized IpObject getById(String id) {
		return ipmap.get(id);
	}


}
